import pandas as pd
import matplotlib.pyplot as plt
def main():
    aqi_data=pd.read_csv('beijing_aqi.csv')
    top5=aqi_data.sort_values(by=['aqi']).head(5)
    print(top5)
    bottom5=aqi_data.sort_values(by=['aqi'],ascending=False).head(5)
    print(bottom5)
    #top5.to_csv('beijing_top5.csv',index=False)
    #bottom5.to_csv('beijing_bottom5.csv',index=False)
    top5=pd.DataFrame(top5)
    top5.plt(kind='bar',title='aqi')
if __name__=='__main__':
    main()